package com.aerozhonghuan.oknet2;

import okhttp3.MediaType;

/**
 * 消息体类型的请求
 * Created by zhangyunfei on 17/6/22.
 */

public class BodyStringRequest extends CommonRequest {
    private static final MediaType MEDIA_JSON = MediaType.parse("application/json; charset=utf-8");

    private MediaType mimeType;
    private String bodyString;

    /**
     * @param url                    url
     * @param content                content
     * @param myJsonResponseHandler3 myJsonResponseHandler3
     */
    public BodyStringRequest(String url, String content, CommonCallback<?> myJsonResponseHandler3) {
        super(url, null, myJsonResponseHandler3);
        this.bodyString = content;
        this.mimeType = MEDIA_JSON;

    }

    /**
     * @param url                    url
     * @param mimeType               paras
     * @param content                content
     * @param myJsonResponseHandler3 myJsonResponseHandler3
     */
    public BodyStringRequest(String url, String mimeType, String content, CommonCallback<?> myJsonResponseHandler3) {
        super(url, null, myJsonResponseHandler3);
        this.bodyString = content;
        this.mimeType = MediaType.parse(mimeType);

    }

    public MediaType getMediaType() {
        return mimeType;
    }

    public String getBodyString() {
        return bodyString;
    }
}
